#include <bits/stdc++.h>

using namespace std;

string max1 = "", max2 = "", min1 = "", min2 = "", s = "";//三个数字字符串
int l1 = 0, l2 = 0, ls = 0;//三个字符串的长度

//判断n1是否比n2大
bool strMax(string n1, string n2){
    if(n1.length() < n2.length() || (n1.length() == n2.length() && n1 < n2))
        return false;
    return true;
}

string strAdd(string n1, string n2){
    if(!strMax(n1, n2)){
        string temp = n1;
        n1 = n2;
        n2 = temp;
    }
    bool flag = false;
    int i = n1.length() - 1, j = n2.length() - 1;
    while(i >= 0){
        int t1 = n1[i] - '0', t2;
        if(j >= 0)
            t2 = n2[j] - '0';
        else
            t2 = 0;
        t1 += t2;
        if(flag)
            t1++;
        if(t1 >= 10){
            t1 %= 10;
            flag = true;
        }
        else
            flag = false;
        n1[i] = t1 + '0';
        i--, j--;
    }
    if(flag)
        return '1' + n1;
    else
        return n1;
}

string strSub(string n1, string n2){
    if(!strMax(n1, n2)){
        string temp = n1;
        n1 = n2;
        n2 = temp;
    }
    bool flag = false;
    int i = n1.length() - 1, j = n2.length() - 1;
    while(i >= 0){
        int t1 = n1[i] - '0', t2;
        if(j >= 0)
            t2 = n2[j] - '0';
        else
            t2 = 0;
        t1 -= t2;
        if(flag)
            t1--;
        if(t1 < 0){
            t1 += 10;
            flag = true;
        }
        else
            flag = false;
        n1[i] = t1 + '0';
        i--, j--;
    }
    for(i = 0; i < n1.length() - 1; i++)
        if(n1[i] != '0')
            break;
    return n1.substr(i);
}

int strRem(string n1, int t2){
    string n2 = to_string(t2);
    if(!strMax(n1, n2)){
        return stoi(n1);
    }
    while(strMax(n1, n2)){
        if(n1.length() > n2.length()){
            int t1 = stoi(n1.substr(0, n2.length() + 1)),ts;
            ts = t1 % t2;
            n1 = to_string(ts) + n1.substr(n2.length() + 1);
        }
        else{
            int t1 = stoi(n1.substr(0, n2.length())),ts;
            ts = t1 % t2;
            n1 = to_string(ts) + n1.substr(n2.length());
        }
    }
    return stoi(n1);
}

int main(){
    char c;
    int num = 0;
    while((c = getchar() != '+')){
        max1 += '9';
        if(l1 == 0)
            min1 += '1';
        else
            min1 += '0';
        l1++;
    }
    while((c = getchar() != '=')){
        max2 += '9';
        if(l2 == 0)
            min2 += '1';
        else
            min2 += '0';
        l2++;
    }
    while((c = getchar()) != '\n'){
        s += c;
        ls++;
    }
    if(strMax(strAdd(min1, min2),s) || strMax(s,strAdd(max1, max2)))
        num = 0;
    else{
        num = strRem(strSub(strSub(s, min1), min2), 1000000007);//少了一次
        num++;
    }
    printf("%d", num);
    return 0;
}
